package com.trsj.lnsj.common;

import java.util.HashMap;

/**
 * message constants
 *
 * @author LinRain
 * @date 2013-04-18
 */
public class MsgStatus {
  public static final int STATUS_OK = 300;
  //
  public static final int STATUS_FAILED = 301;
  public static final int UNREGISTED = 302;
  public static final int EASE_FAILED = 303;
  public static final int VALIDCODE_ERROR = 304;
  public static final int PARAMS_INVALID = 305;
  public static final int PWD_VALID_FAIL = 306;
  public static final int SMS_LIMITED = 307;
  public static final int SYS_ERROR = 308;
  public static final int VALIDCODE_OVERDUE = 309;
  public static final int USER_NOT_EXIST = 310;
  public static final int SMS_FAILED = 311;
  public static final int TOKEN_FAILED = 312;
  public static final int TOKEN_EXPIRED = 313;
  public static final int DATA_REPEATED = 314;
  private static HashMap<Integer, String> sIdReasonMap = new HashMap<>();

  static {

    addStatusCodeMap(STATUS_OK, "请求数据成功");
    addStatusCodeMap(STATUS_FAILED, "请求失败");
    addStatusCodeMap(UNREGISTED, "登录失败");
    addStatusCodeMap(EASE_FAILED, "用户环信账号注册不成功");
    addStatusCodeMap(VALIDCODE_ERROR, "手机验证码不正确");
    addStatusCodeMap(PARAMS_INVALID, "参数格式错误");
    addStatusCodeMap(PWD_VALID_FAIL, "登录密码错误");
    addStatusCodeMap(SMS_LIMITED, "规定时间内不能重复获取验证码");
    addStatusCodeMap(SYS_ERROR, "服务器出错");
    addStatusCodeMap(VALIDCODE_OVERDUE, "手机验证码过期");
    addStatusCodeMap(USER_NOT_EXIST, "该登录账号未注册");
    addStatusCodeMap(SMS_FAILED, "短信发送失败");
    addStatusCodeMap(TOKEN_FAILED, "TOKEN验证失败");
    addStatusCodeMap(TOKEN_EXPIRED, "TOKEN过期");
    addStatusCodeMap(DATA_REPEATED, "不能添加重复数据");
  }

  public static String getStatusText(int statusCode) {
    return sIdReasonMap.get(statusCode);
  }

  private static void addStatusCodeMap(int statusCode, String reasonPhrase) {
    sIdReasonMap.put(statusCode, reasonPhrase);
  }

}
